package com.sll.hosptials.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sll.hosptials.controller.req.DictInfoPageReq;
import com.sll.hosptials.controller.req.DictReq;
import com.sll.hosptials.model.DictInfo;
import com.sll.hosptials.service.DictInfoService;
import com.sll.hosptials.vo.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@Api(tags = "字典信息")
@RequestMapping("/dictInfo")
@RestController
public class DictInfoController {

    @Resource
    private DictInfoService dictInfoService;

    @ApiOperation("获取字典分页")
    @PostMapping("dictPage")
    public Result<Page<DictInfo>> dictPage(@RequestBody DictInfoPageReq req){
        return Result.success(dictInfoService.page(req));
    }

    @PostMapping("dictTreeList")
    @ApiOperation("根据字典类型获取树形字典结构")
    public Result<List<DictInfo>> dictTreeList(DictReq dictReq){
        return Result.success(dictInfoService.dictTreeList(dictReq));

    }




}
